package de.slothsoft.commons;

import java.util.Date;
import java.util.Random;

/**
 * For pseudo-random numbers
 */
public class RandomUtil {

	/**
	 * Creates a random class initialized with the current date
	 */

	public static Random createDateInstance() {
		return createDateInstance(0);
	}

	/**
	 * Creates a random class initialized with the current date plus an offset
	 * (for more variability)
	 */

	public static Random createDateInstance(int offset) {
		Date date = new Date();
		long time = date.getTime();
		int milliSecondsInDay = 1000 * 60 * 60 * 24;
		time /= milliSecondsInDay;
		return new Random(time + offset);
	}
}
